/**
 * 
 */
package it.uniroma3.engine.factory;

import it.uniroma3.engine.paramer.EngineParameter;

import java.io.IOException;

import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.store.RAMDirectory;

/**
 * @author Accosta Augusto
 * @author Lopez Elisabetta
 *
 */
public class DirectoryFactory {

	/**
	 * 
	 * @return a new {@code RAMDirectory}
	 * @throws IOException
	 */
	public static Directory getRAMDirectory() throws IOException {
		return EngineParameter.RAM_DIRECTORY;
	}
	
	/**
	 * 
	 * @return a new {@code FSDirectory}
	 * @throws IOException
	 */
	public static Directory getFSDirectory() throws IOException {
		return FSDirectory.open(EngineParameter.INDEX);
	}
	
	/**
	 * 
	 * @return a new {@code RAMDirectory} builded on the current {@code FSDirectory}
	 * @throws IOException
	 */
	public static Directory getRAMDirectoryFromFSDirectory() throws IOException {
		return new RAMDirectory(getFSDirectory());
	}
	
}
